#include <ev.h>
#include <amqpcpp.h>
#include <amqpcpp/libev.h>
#include <openssl/ssl.h>
#include <openssl/opensslv.h>
#include <gflags/gflags.h>
#include "../../Common/RabbitMQ.hpp"
DEFINE_bool(log_mod,false,"true为发布模式,false为调试模式");
DEFINE_string(log_file,"","发布模式下日志存储的文件");
DEFINE_int32(log_level,0,"要输出的日志等级");
DEFINE_string(user,"root","RabbitMQ访问用户名");
DEFINE_string(password,"123456","RabbitMQ访问密码");
DEFINE_string(host,"127.0.0.1:5672","RabbitMQ服务器地址信息,格式为:xxx.xxx.xxx.xxx:xxxx");

void callback(const std::string message)
{
     std::cout<<"我收到的消息:"<<message<<std::endl;
}
int main(int argc,char* argv[])
{
    google::ParseCommandLineFlags(&argc,&argv,true);
    init_logger(FLAGS_log_mod,FLAGS_log_file,(spdlog::level::level_enum)FLAGS_log_level);
    RMQClient rmqc(FLAGS_user,FLAGS_password,FLAGS_host);
    rmqc.declareComponents("test_exchange","test_queue");
    rmqc.consume("test_queue",callback);
    std::this_thread::sleep_for(std::chrono::seconds(60));
    return 0;
}